#include<bits/stdc++.h>

using namespace std;
int a[100][100];
int n;

bool up(int &x, int &y) {
    if (x == 0 || a[x - 1][y] != 0)return false;
    --x;
    return true;
}

bool down(int &x, int &y) {
    if (x == n - 1 || a[x + 1][y] != 0)return false;
    ++x;
    return true;
}

bool left(int &x, int &y) {
    if (y == 0 || a[x][y - 1] != 0)return false;
    --y;
    return true;
}

bool right(int &x, int &y) {
    if (y == n - 1 || a[x][y + 1] != 0)return false;
    ++y;
    return true;
}

int main() {
    cin >> n;
    int x = 0, y = 0;
    int k = 1;
    a[x][y] = k++;
    while (k <= n * n) {
        while (k <= n * n && right(x, y))a[x][y] = k++;
        while (k <= n * n && down(x, y))a[x][y] = k++;
        while (k <= n * n && left(x, y))a[x][y] = k++;
        while (k <= n * n && up(x, y))a[x][y] = k++;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}